package org.bbl.db.mybatis.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.bbl.db.domain.WordSpell;

import java.util.List;

/**
 * @author biniamg
 * @since 1/8/13
 */
public interface WordSpellMapper extends BaseMapper<WordSpell> {

//    @Select("SELECT * FROM WORDSPELL WHERE languageId = #{param1} AND word like #{param2}")
//    List<WordSpell> findByParentId(int param1, String param2, RowBounds rowBounds);

    @Delete("DELETE FROM WORDSPELL WHERE languageId = #{param1}")
    void delete(int param1);

    @Insert("INSERT INTO WORDSPELL (languageId,word,root,rootSera,sera,seraLower,seraNoVowel,frequency) VALUES" +
            "(#{languageId}," +
            "#{word}," +
            "#{root}," +
            "#{rootSera}," +
            "#{sera}," +
            "#{seraLower}," +
            "#{seraNoVowel}," +
            "#{frequency})")
    void insert(WordSpell wordSpell);

    @Select("SELECT * FROM WORDSPELL WHERE languageId = #{param1} AND word = #{param2}")
    WordSpell findByIdentifier(int param1, String param2);

    @Select("SELECT * FROM WORDSPELL WHERE languageId = #{param1} AND root = #{param2}")
    List<WordSpell> findMySibling(int param1, String param2);


}
